var mysql  = require('mysql') 
var connection = mysql.createConnection({     
  host     : 'localhost',       
  user     : 'root',              
  password : '123456',       
  port     : '3306',                   
  database: 'test' 
})  
connection.connect() 
var modSql = 'UPDATE user SET name = ?,password = ? WHERE Id = ?'
var modSqlParams = ['LiMing', '999',2]
connection.query(modSql,modSqlParams,function (err, result) {
   if(err){
         console.log('[UPDATE ERROR] - ',err.message)
         return
   }        
  console.log('--------------------------UPDATE----------------------------')
  console.log('UPDATE affectedRows',result.affectedRows)
  console.log('-----------------------------------------------------------------\n\n')
}) 
connection.end()